package com.zxy.cover.service.impl;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zxy.common.utils.PageUtils;
import com.zxy.common.utils.Query;

import com.zxy.cover.dao.CoverDao;
import com.zxy.cover.entity.CoverEntity;
import com.zxy.cover.service.CoverService;


@Service("coverService")
public class CoverServiceImpl extends ServiceImpl<CoverDao, CoverEntity> implements CoverService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<CoverEntity> wrapper = new QueryWrapper<>();
        String address = (String) params.get( "address" );
        if (StringUtils.isNotEmpty( address )){
            wrapper.and( w->{
                w.like( "address" , address );
            } );
        }
        wrapper.eq( "start","0" );
        IPage<CoverEntity> page = this.page(
                new Query<CoverEntity>().getPage(params),
                wrapper
        );

        return new PageUtils(page);
    }

}